//
//  CardDetailsCell.swift
//  NewCard
//
//  Created by yihui on 2017/11/18.
//  Copyright © 2017年 yihui. All rights reserved.
//

import UIKit

class CardDetailsCell: UITableViewCell {

    //MARK: -- 属性
    // 银行名称
    @IBOutlet weak var bankNameLabel: UILabel!
    // 银行卡号
    @IBOutlet weak var bankCardLabel: UILabel!
    // 账单日
    @IBOutlet weak var billDateLabel: UILabel!
    // 还款日
    @IBOutlet weak var returnDateLabel: UILabel!
    // 固定额度
    @IBOutlet weak var totalLabel: UILabel!
    // 临时额度
    @IBOutlet weak var temporaryAmountLabel: UILabel!
    // 可用额度
    @IBOutlet weak var usableAmountLabel: UILabel!
    // 欠款金额
    @IBOutlet weak var oweLabel: UILabel!
    // 消费Button
    @IBOutlet weak var sendMoneyButton: UIButton!
    // 还款Button
    @IBOutlet weak var repayButton: UIButton!
    
    var cardModel : CardModel?
    {
        didSet{
            bankNameLabel.text = cardModel!.bankName
            bankCardLabel.text = String(cardModel!.bankCard)
            billDateLabel.text = String("账单日:\(cardModel!.billDate)")
            returnDateLabel.text = String("还款日:\(cardModel!.returnDate)")
            totalLabel.text = "总:\(Tools.calculation(cardModel!.total))"
            temporaryAmountLabel.text = "临:\(Tools.calculation(cardModel!.temporaryAmount))"
            usableAmountLabel.text = "可:\(Tools.calculation(cardModel!.usableAmount))"
            oweLabel.text = "欠:\(Tools.calculation(cardModel!.total - cardModel!.usableAmount))"
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        
        sendMoneyButton.layer.cornerRadius = 4
        repayButton.layer.cornerRadius = 4
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
    deinit {
        //HHLog("销毁")
    }

}
